﻿CREATE PROCEDURE [dbo].[spCreateNewCompany]
	( @shortname nvarchar(50), @longname nvarchar(100) )
as
begin
	set nocount on
	declare @OwnerID int
	begin transaction

	insert into tblOwner ( SHortName, LongName, AllowPartialShipments, Active ) values ( @shortname, @longname, 0, 1 )
	set @OwnerID = SCOPE_IDENTITY()

	insert into codeProductPricingClass ( OwnerID, Description )
	values ( @OwnerID, 'Default' )

	insert into codeIDSource ( OwnerID, IDSourceCode, Description )
	values ( @OwnerID, 'W', 'Web Service' )
	insert into codeIDSource ( OwnerID, IDSourceCode, Description )
	values ( @OwnerID, 'I', 'Imported' )

	commit
	return @OwnerID
end
